/* vim: set sw=4 sts=4 : */

/*
 * Copyright (c) 2009, David B. Cortarello & Rubén Bonardi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    This product includes software developed by the <organization>.
 * 4. Neither the name of the <organization> nor the
 *    names of its contributors may be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef COMMANDS_H
#define COMMANDS_H

#define NO_MORE_CONNECTIONS "No more connections available\r\n"
#define STR_USER "User: "
#define STR_PASSWD "Passwd: "
#define LOGIN_INCORRECT "Login incorrect\r\n"
#define TOO_MANY_LOGIN_ATTEMPTS "Too many login attempts\r\n"
#define LOGGED_IN "Logged in...\r\n"
#define EXITING "Thanks for visiting. Exiting...\r\n"
#define WRONG_COMMAND "Invalid command. type 'help'...\r\n"

#define READ 0
#define WRITE 1
#define EXIT 2
#define QUIT 3
#define WHO 4
#define SEARCH 5
#define TALK 6
#define ROOM 7
#define HELP 8
#define NEWS 9
#define PARTY 10

typedef struct _iCommands {
	char *command;
	int len;
	int type;
	char *usage;
} iCommands;

int auth(iConnections *self);

int command_parser(char *buf, int len);

void DoCommands(iConnections *self);

#endif

